<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>[|.siteName|]</title>
    [|if .zTree|]
    <link rel="stylesheet" href="/static/zTree3/css/demo.css?t=5" type="text/css">
    <link rel="stylesheet" href="/static/zTree3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    [|end|]
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/main.css">
    <script src="/static/layui/layui.js?s=36"></script>
    <script src="/static/js/main.js?s=2124"></script>
</head>

<body>
<div>
    <form>
        <div class="layui-input-inline">
            
         

            <div class="layui-inline">
                <label class="layui-form-label">时间:</label>
                <div class="layui-input-inline" style="width:100px;">
                    <input type="text" name="BeforDateTime" id="BeforDateTime" lay-verify="date" placeholder="" autocomplete="off" class="layui-input" value="">

                </div>
                <label>-</label>
                <div class="layui-input-inline" style="width:100px;">
                    <input type="text" name="AfterDateTime" id="AfterDateTime" lay-verify="date" placeholder="" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            
            <div class="layui-inline">
                <label class="layui-form-label">输赢:</label>
                <div class="layui-input-inline" style="width:120px">
                    <input type="number" name="UserWinGoldL" id="UserWinGoldL" lay-verify="required|number" autocomplete="off" class="layui-input" value="">
                </div>
                <label>-</label>
                 <div class="layui-input-inline" style="width:120px;">
                    <input type="number" name="UserWinGoldB" id="UserWinGoldB" lay-verify="required|number" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" >结果集数:</label>
                <div class="layui-input-inline" style="width:120px">
                    <input type="number" name="Gamelimit" id="Gamelimit" lay-verify="required|number" autocomplete="off" class="layui-input" value="" min = "1">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label" style="width:120px">游戏ServerID:</label>
                <div class="layui-input-inline" style="width:120px">
                    <input type="number" name="ServerID" id="ServerID" lay-verify="required|number" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="starquery">开始查询</button>
            </div>

        </div>

    </form>
    <table  class="layui-table" id="userinfotable" lay-size="sm" lay-filter="layfilteruserinfotable"> </table> 
</div>

<script>
    var $;

    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery','table','laydate'], function(){
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        var laydate = layui.laydate;
        $ = layui.jquery;
    //监听表格复选框选择
   // table.on('checkbox(demo)', function(obj){
    //   console.log(obj);
   // });

    //监听工具条
    laydate.render({
        elem: '#BeforDateTime'
      });
    laydate.render({
        elem: '#AfterDateTime'
    });
 
    ShowUserDatas();
    ShowTablesDatas(table)
    form.on('submit(starquery)', function(data) { 
        ShowTablesDatas(table)   
        return false;
    });

    //监听单元格事件
   table.on('tool(layfilteruserinfotable)', function(obj){
        var data = obj.data;
        if(obj.event === 'UserInfo'){
            window.location.href="/usersfinduser/userinfopage.html?UserID=" + data.columnA;
            return false;
        }
     });
   
    return false;
}); 


function ShowTablesDatas(thisTabble){
 
   
    var dBeforDateTime =  document.getElementById("BeforDateTime");
    var dAfterDateTime =  document.getElementById("AfterDateTime");
    var dUserWinGoldL =  document.getElementById("UserWinGoldL");
    var dUserWinGoldB =  document.getElementById("UserWinGoldB");
    var dGamelimit =  document.getElementById("Gamelimit");
    var dServerID =  document.getElementById("ServerID");

    thisTabble.render({
        elem:'#userinfotable'
        ,url:'/userrecord/userrecordwinlosetable'
        ,where: {
                BeforDateTime:dBeforDateTime.value
                ,AfterDateTime:dAfterDateTime.value
                ,UserWinGoldL:dUserWinGoldL.value
                ,UserWinGoldB:dUserWinGoldB.value
                ,Gamelimit:dGamelimit.value
                ,ServerID:dServerID.value
       
        }
        ,done: function(res, curr, count) {
           // GetPageTitleData(res.titleinfo)
        }
        ,cols: [[ //标题栏
        
            {field:'columnA',title:'推广号',width:240,event: 'UserInfo', style:'cursor: pointer;color: #104E8B;'}
            ,{field:'columnB',title:'输赢',width:240}
            
                ]] 
        ,skin: 'row' //表格风格
        ,even: true
        ,page: true //是否显示分页
        ,limits: [50,100,200]
        ,limit: 100//每页默认显示的数量
        ,width: 'full-10'
        ,rules: 'all'
        ,height: 'full-125'
    });
}

function GetPageTitleData(titleinfo){
  
    if (titleinfo.length > 0)
    {
       
    }
    return false;
 
}

function ShowUserDatas()
{
    var nowData = getNowFormatDate();
    var dBeforDateTime =  document.getElementById("BeforDateTime");
    dBeforDateTime.value = nowData;
    var dAfterDateTime =  document.getElementById("AfterDateTime");
    dAfterDateTime.value = nowData; 
    var dGamelimit =  document.getElementById("Gamelimit");
    dGamelimit.value = 10;
          
} 

function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
 
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
    return currentdate;    
} 

</script>
</body>

</html>